<?php

namespace CMS\Updater\Models;
/**
 * Pomocne funkce pro entitni tridu Template.
 *
 * @author David Dusek
 */

use Doctrine\ORM\EntityRepository;

class TemplateRepository extends EntityRepository {
       
    /**
     * Vrati stranku ktera je oznacena jako hemepage.
     * @return boolean 
     */
    public function getSelectOptions() {
        $qb = $this->_em->createQueryBuilder();
        $qb = $qb->select("t")
                 ->from("\CMS\Updater\Models\Template", 't')
                 ->orderBy("t.name");        
        $result = $qb->getQuery()->getResult();
        
        $options = array();
        foreach ($result as $domain) {
            $options[$domain->id] = $domain->name;
        }
        
        return $options;
    }
}
